﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.RealiZation
{
    public static class IQueryableExtensions
    {
        /// <summary>
        /// 导航属性，参数：导航属性名称字符串，支持多表查询
        /// 多级导航属性：“属性名.属性名”  用‘.’连接
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        /// <param name="Properts"></param>
        /// <returns></returns>
        public static IQueryable<T> In<T>(this IQueryable<T> obj, params string[] Properts) where T : class
        {
            IQueryable<T> data = obj;
            foreach (var prop in Properts)
            {
                data = data.Include(prop);
            }
            return data;
        }

    }
}
